<template>
  <div>
    <!-- 3.遍历 -->
    <!-- <v-button
      v-for="item in arr"
      :key="item.id"
      @click="$router.push('/list?id=' + item.id)"
      >{{ item.catename }}</v-button
    > -->
    <van-tabs @click="onClick">
      <van-tab v-for="item in arr"
      :key="item.id" :title="item.catename">
        
      </van-tab>
    </van-tabs>
  </div>
</template>

<script>
import { reqhomecate } from "../../../http/http";
export default {
  data() {
    return {
      // 1.初始化数据
      arr: [],
    };
  },
  mounted() {
    //2.发请求
    reqhomecate().then((res) => {
      //   console.log(res);
      this.arr = res.data.list;
    });
  },
  methods:{
    onClick(index){
   
      this.$router.push("/list?id="+this.arr[index].id)
    }
  }
};
</script>

<style>
</style>